﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.DynamicData.ModelProviders;
using NHibernate.Mapping;
using Mpu.NHibernateDataModelProvider.AssociationProviders;

namespace Mpu.NHibernateDataModelProvider.ColumnProviders
{
    public class NHibernateOneToManyColumnProvider : NHibernateColumnProviderBase
    {
        private OneToMany element;

        public NHibernateOneToManyColumnProvider(TableProvider table, NHibernate.Mapping.Property property, OneToMany element)
            : base(table)
        {
            this.Name = property.Name;
            this.ColumnType = property.Type.ReturnedClass;

            this.element = element;
        }

        public override void Initialize()
        {
            base.Initialize();

            this.Association = new NHibernateOneToManyAssociationProvider(this, element);
        }

        public override void InitializeAssociation()
        {
            base.InitializeAssociation();
        }
    }
}
